package com.example.respose;

import lombok.Data;

/**
 * @author ljs
 * @date 2025/7/22
 */
@Data
public class Result <T>{
    private int code;
    private String msg;
    private T data;

    public Result(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    public static Result success(){
        return new Result(200,"success",null);
    }

    public static <T> Result success(T data){
        return new Result(200,"success",data);
    }

    public static <T> Result success(String msg,T data){
        return new Result(200,msg,data);
    }

   public static Result failed(){
        return new Result(500,"failed",null);
   }
   public static Result failed(String msg){
        return new Result(500,msg,null);
   }

   public static <T> Result none(){
        return new Result(404,"none",null);
   }

}
